<template>
  <div class="purchase">
    <!-- *购买 -->
    <ul class="book-purchase">
      <li class="l1">
        <a href="javascript:;">
          <img :src="this.NotPurchased[0].imgSrc" alt="">
          <p>未购买</p>
          <p class="last">{{this.NotPurchased.length}}本</p>
        </a>
      </li>
      <li class="l2">
        <a href="javascript:;">
          <img :src="this.purchase[0].imgSrc" alt="">
          <p>已购买</p>
          <p class="last">{{this.purchase.length}}</p>
        </a>
      </li>
    </ul>
    <div class="footer">
      <p><span>9</span>本公开阅读</p>
      <div class="chakan"><a href="javascript:;">查看我的公开页面</a></div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Purchase',

  data() {
    return {
      NotPurchased:[], //* 未购买
      purchase:[], //* 购买
    };
  },
  props:['mess'],
  created() {
    this.fn_dataBuy()
  },

  methods: {
    fn_dataBuy(){
      this.mess.forEach(item=>{
        if(item.buy){
          this.NotPurchased.push(item)
        }else{
          this.purchase.push(item)
        }
      })
    }
  },
};
</script>

<style lang="less" scoped>
  .purchase {
  width: 100%;
  box-sizing: border-box;
  .book-purchase {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    li {
      width: 32%;
      // border:1px solid #ccc;
      height: 2.8rem;
      margin: 0.2rem 0 0.3rem 0;
      a {
        text-align: left;
        // display: block;
        img {
          width: 100%;
          height: 90%;
          display: block;
        }
        p {
          margin: 0;
          padding: 0;
          color: #000;
          text-align: center;
        }
        .last{
          color:#666;
        }
      }
    }
    &::after{
      content:"";
      display:block;
      width:32%;
    }
  }
  .footer {
    margin-top: 0.5rem;
    text-align: center;
    p {
      font-size: 0.12rem;
      color: #999;
      margin: 0;
      padding: 0;
    }
    .chakan {
      width: 100%;
      font-size: 0.13rem;
      margin-top: 0.1rem;
    }
  }
}
</style>